home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Essentials / Technical.Notes / PDOS / TN.PDOS.025 < prev    next >
Encoding:
Text File  |  1991-11-15  |  11.5 KB  |  231 lines  |  [TEXT/pdos]

  1. Apple II
  2. Technical Notes
  3. _____________________________________________________________________________
  4.                                                   Developer Technical Support
  5.  
  6.  
  7. ProDOS 8
  8. #25:    Non-Standard Storage Types
  9.  
  10. Revised by:    Matt Deatherage                                  December 1991
  11. Written by:    Matt Deatherage                                      July 1989
  12.  
  13. This Technical Note discusses storage types for ProDOS files which are not 
  14. documented in the ProDOS 8 Technical Reference Manual.
  15.  
  16. Warning:  The information provided in this Note is for the use of disk 
  17.           utility programs which occasionally must manipulate non-
  18.           standard files in unusual situations.  ProDOS 8 programs 
  19.           should not create or otherwise manipulate files with non-
  20.           standard storage types.
  21.  
  22. Changes since July 1989:  Included new information on storing HFS Finder
  23. information in extended files' extended key blocks.
  24. _____________________________________________________________________________
  25.  
  26.  
  27. Introduction
  28.  
  29. One of the features of the ProDOS file system is its ability to let ProDOS 8 
  30. know when someone has put a file on the disk that ProDOS 8 can't access.  A 
  31. file not created by ProDOS 8 can be identified by the storage_type field.  
  32. ProDOS 8 creates four different storage types:  seedling files ($1), sapling 
  33. files ($2), tree files ($3), and directory files ($D).  ProDOS 8 also stores 
  34. subdirectory headers as storage type $E and volume directory headers as 
  35. storage type $F.  These are all described in the ProDOS 8 Technical Reference 
  36. Manual.
  37.  
  38. Other files may be placed on the disk, and ProDOS 8 can catalog them, rename 
  39. them, and return file information about them.  However, since it does not know 
  40. how the information in the files is stored on the disk, it cannot perform 
  41. normal file operations on these files, and it returns the Unsupported Storage 
  42. Type error instead.
  43.  
  44. Apple reserves the right to define additional storage types for the extension 
  45. of the ProDOS file system in the future.  To date, two additional storage 
  46. types have been defined.  Storage type $4 indicates a Pascal area on a ProFile 
  47. hard disk, and storage type $5 indicates a GS/OS extended file (data fork and 
  48. resource fork) as created by the ProDOS FST.
  49.  
  50.  
  51. Storage Type $4
  52.  
  53. Storage type $4 is used for Apple II Pascal areas on Profile hard disk drives.  
  54. These files are created by the Apple Pascal ProFile Manager.  Other programs 
  55. should not create these files, as Apple II Pascal could freak out.
  56.  
  57. The Pascal Profile Manager (PPM) creates files which are internally divided 
  58. into pseudo-volumes by Apple II Pascal.  The files have the name PASCAL.AREA 
  59. (name length of 10), with file type $EF.  The key_pointer field of the 
  60. directory entry points to the first block used by the file, which is the 
  61. second to last block on the disk.  As ProDOS stores files non-contiguously up 
  62. from the bottom, PPM creates pseudo-volumes contiguously down from the end of 
  63. the ProFile.  Blocks_used is 2, and header_pointer is also 2.  All other 
  64. fields in the directory are set to 0.  PPM looks for this entry (starting with 
  65. the name PASCAL.AREA) to determine if a ProFile has been initialized for 
  66. Pascal use.
  67.  
  68. The file entry for the Pascal area increments the number of files in the 
  69. ProDOS directory and the key_pointer for the file points to TOTAL_BLOCKS - 2, 
  70. or the second to last block on the disk.  When PPM expands or contracts the 
  71. Pascal area, blocks_used and key_pointer are updated accordingly.  With any 
  72. access to this entry (such as adding or deleting pseudo-volumes within PPM), 
  73. the backup bit is not set (PPM provides a utility to back up the Pascal area).
  74.  
  75. The Pascal volume directory contains two separate contiguous data structures 
  76. that specify the contents of the Pascal area on the Profile.  The volume 
  77. directory occupies two blocks to support 31 pseudo-volumes.  It is found at 
  78. the physical block specified in the ProDOS volume directory as the value of 
  79. key_pointer (i.e., it occupies the first block in the area pointed to by this 
  80. value).
  81.  
  82. The first portion of the volume directory is the actual directory for the 
  83. pseudo-volumes.  It is an array with the following Apple II Pascal 
  84. declaration:
  85.  
  86. TYPE    RTYPE = (HEADER, REGULAR)
  87.  
  88. VAR     VDIR:    ARRAY [0..31] OF
  89.             PACKED RECORD
  90.                 CASE RTYPE OF
  91.                     HEADER:    (PSEUDO_DEVICE_LENGTH:INTEGER;
  92.                                CUR_NUM_VOLS:INTEGER;
  93.                                PPM_NAME:STRING[3]);
  94.                     REGULAR:   (START:INTEGER;
  95.                                DEFAULT_UNIT:0.255
  96.                                FILLER:0..127
  97.                                WP:BOOLEAN
  98.                                OLDDRIVERADDR:INTEGER
  99.             END;
  100.  
  101. The HEADER specifies information about the Pascal area.  It specifies the size 
  102. in blocks in PSEUDO_DEVICE_LENGTH, the number of currently allocated volumes 
  103. in CUR_NUM_VOLS, and a special validity check in PPM_NAME, which is the three-
  104. character string PPM.  The header information is accessed via a reference to 
  105. VDIR[0].  The REGULAR entry specifies information for each pseudo-volume.  
  106. START is the starting block address for the pseudo-volume, and LENGTH is the 
  107. length of the pseudo-volume in blocks.  DEFAULT_UNIT specifies the default 
  108. Pascal unit number that this pseudo-volume should be assigned to upon booting 
  109. the system.  This value is set through the Volume Manager by either the user 
  110. or an application program, and it remains valid if it is not released.
  111.  
  112. If the system is shut down, the pseudo-volume remains assigned and will be 
  113. active once the system is rebooted.  WP is a Boolean that specifies if the 
  114. pseudo-volume is write-protected.  OLDDRIVERADDR holds the address of this 
  115. unit's (if assigned) previous driver address.  It is used when normal floppy 
  116. unit numbers are assigned to pseudo-volumes, so when released, the floppies 
  117. can be reactivated.  Each REGULAR entry is accessed via an index from 1 to 31.  
  118. This index value is thus associated with a pseudo-volume.  All references to 
  119. pseudo-volumes in the Volume Manager are made with these indexes.
  120.  
  121. Immediately following the VDIR array is an array of description fields for 
  122. each pseudo-volume:
  123.  
  124.     VDESC:    ARRAY [0..31] OF STRING[15]
  125.  
  126. The description field is used to differentiate pseudo-volumes with the same 
  127. name.  It is set when the pseudo-volume is created.  This array is accessed 
  128. with the same index as VDIR.
  129.  
  130. The volume directory does not maintain the names of the pseudo-volumes.  These 
  131. are found in the directories in each pseudo-volume.  When the Volume Manager 
  132. is activated, it reads each pseudo-volume directory to construct an array of 
  133. the pseudo-volume names:
  134.  
  135.     VNAMES:   ARRAY [0..31] OF STRING[7]
  136.  
  137. Each pseudo-volume name is stored here so the Volume Manager can use it in its 
  138. display of pseudo-volumes.  The name is set when the pseudo-volume is created 
  139. and can be changed by the Pascal Filer.  The names in this array are accessed 
  140. via the same index as VDIR.  This array is set up when the Volume Manager is 
  141. initialized and after there is a delete of a pseudo-volume.  Creating a 
  142. pseudo-volume will add to the array at the end.
  143.  
  144. Pascal Pseudo-Volume Format
  145.  
  146. Each Pascal pseudo-volume is a standard UCSD formatted volume.  Blocks 0 and 1 
  147. are reserved for bootstrap loaders (which are irrelevant for pseudo-volumes).  
  148. The directory for the volume is in blocks 2 through 5 of the pseudo-volume.  
  149. When a pseudo-volume is created, the directory for that pseudo-volume is 
  150. initialized with the following values:
  151.  
  152. dfirstblock = 0            first logical block of the volume
  153. dlastblock = 6             first available block after the directory
  154. dvid    = name of the volume used in create
  155. deovblk = size of volume specified in create
  156. dnumfiles = 0              no files yet
  157. dloadtime = set to current system date
  158. dlastboot = 0
  159.  
  160. The Apple II Pascal 1.3 Manual contains the format for the UCSD directory.  
  161. Files within this subdirectory are allocated via the standard Pascal I/O 
  162. routines in a contiguous manner.
  163.  
  164.  
  165. Storage Type $5
  166.  
  167. Storage type $5 is used by the ProDOS FST in GS/OS to store extended files.  
  168. The key block of the file points to an extended key block entry.  The extended 
  169. key block entry contains mini-directory entries for both the data fork and 
  170. resource fork of the file.  The mini-entry for the data fork is at offset +000 
  171. of the extended key block, and the mini-entry for the resource fork is at 
  172. offset +$100 (+256 decimal).
  173.  
  174. The format for mini-entries is as follows:
  175.  
  176. storage_type    (+000)    Byte    The standard ProDOS storage 
  177.                                   type for this fork of the file.  
  178.                                   Note that for regular directory 
  179.                                   entries, the storage type is the 
  180.                                   high nibble of a byte that contains 
  181.                                   the length of the filename as the 
  182.                                   low nibble.  In mini-entries, the 
  183.                                   high nibble is reserved and must be 
  184.                                   zero, and the storage type is 
  185.                                   contained in the low nibble.
  186. key_block       (+001)    Word    The block number of the key 
  187.                                   block of this fork.  This value and 
  188.                                   the value of storage_type combine to 
  189.                                   determine how to find the data in 
  190.                                   the file, as documented in the 
  191.                                   ProDOS 8 Technical Reference Manual.
  192. blocks_used     (+003)    Word    The number of blocks used by 
  193.                                   this fork of the file.
  194. EOF             (+005)    3 Bytes Three-byte value (least 
  195.                                   significant byte stored first) 
  196.                                   representing the end-of-file value 
  197.                                   for this fork of the file.
  198.  
  199. Immediately following the mini-entry for the data fork may be up to two 
  200. eighteen-byte entries, each with part of the HFS Finder information for 
  201. this file.  The first entry stores the first 16 bytes of the Finder 
  202. information, and the second entry stores the second 16 bytes.  The 
  203. format is as follows:
  204.  
  205. entry_size    (+008)    Byte    Size of this entry; must be 18 ($12).
  206. entry_type    (+009)    Byte    Type of this entry--1 for FInfo (first 16
  207.                                 bytes of Finder information), 2 for 
  208.                                 xFInfo (second 16 bytes).
  209. FInfo         (+010)  16 Bytes  First sixteen bytes of Finder Info.
  210. entry_size    (+026)    Byte    Size of this entry; must be 18 ($12).
  211. entry_type    (+027)    Byte    Type of this entry--1 for FInfo (first 16
  212.                                 bytes of Finder information), 2 for 
  213.                                 xFInfo (second 16 bytes).
  214. xFInfo        (+028)  16 Bytes  Second sixteen bytes of Finder Info.
  215.  
  216. Note:    Although the ProDOS FST under GS/OS will only create both of the
  217.          mini-entries, as described above, the ProDOS File System Manager
  218.          (ProDOS FSM) for the Macintosh, which is part of the Apple IIe
  219.          Card v2.0 software, may create only one of the entries, so you 
  220.          may find an entry_type of 2 at offset +009 in the block.  If one 
  221.          of the entries is missing, it should be considered to be all zeroes.
  222.  
  223. All remaining bytes in the extended key block are reserved and must be zero.
  224.  
  225.  
  226. Further Reference
  227. _____________________________________________________________________________
  228.     o    Apple II Pascal ProFile Manager Manual
  229.     o    GS/OS Reference
  230.     o    ProDOS 8 Technical Reference Manual
  231.